package calbs.socket.packaging;

import calbs.socket.pojo.resp.RespData;
import calbs.socket.pojo.resp.RespLoginRefuseMsg;
import calbs.socket.tool.CHexConver;

import static java.lang.Integer.parseInt;


/**
 * Created by Q on 2017/8/11.
 */
public class LoginRefusePackingImp implements PackagingI<RespLoginRefuseMsg> {
    @Override
    public String analysisMsg(RespData<RespLoginRefuseMsg> respData){
        RespLoginRefuseMsg respLoginRefuseMsg = respData.getBody();
        //String content = Integer.parseInt(respLoginRefuseMsg.getErrorId()+"",16)+"";
        String content = CHexConver.integeroHexString(Integer.parseInt(respLoginRefuseMsg.getErrorId()+"",16),4);
        return PackingUtils.packing(respData.getBody(),content);
    }
}
